package com.coolingme.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.DynamicMapping;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

/**
 * 用户类
 *
 * @author wangyue
 * @date 2021/7/27 9:59
 */
@Slf4j
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@DynamicMapping
@Document(indexName = "user", replicas = 0)
public class User {

    /**
     * 主键
     */
    @Id
    private Long id;

    /**
     * 姓名
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", normalizer = "lowercase", searchAnalyzer = "lowercase")
    private String name;

    /**
     * 年龄
     */
    @Field(type = FieldType.Integer)
    private Integer age;

    /**
     * 地址
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", normalizer = "lowercase", searchAnalyzer = "lowercase")
    private String address;

    /**
     * 性别
     */
    @Field(type = FieldType.Keyword)
    private String sex;

    /**
     * 出生日期
     */
    @Field(type = FieldType.Auto)
    private Date birthDay;

    /**
     * 技能
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", normalizer = "lowercase", searchAnalyzer = "lowercase")
    private List<String> skill;


//    @Field(type = FieldType.Auto)
//    private Date createTime = new Date();
}
